package com.iwhalecloud.bss.kite.cucc.service.attr.handler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.common.constant.LocalKeyConsts;
import com.iwhalecloud.bss.kite.cucc.service.util.CalculatePkgUsageUtil;
import com.iwhalecloud.bss.kite.dataservice.cache.DcPublicCache;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;
import com.ztesoft.bss.common.util.ContextUtil;

/**
 * <Description> <br>
 *  端口带宽
 * @author cheng.leizhen01<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2021年3月16日 <br>
 * @since R9.0<br>
 * @see com.iwhalecloud.bss.kite.cucc.service.attr.handler <br>
 */

public class LocalBigBandwidthAttrHandler extends AbstractAttrHandler<KiteInst, AttrData> {

    @Override
    public void onShow(KiteAttr attr, KiteInst inst, AttrData data) {
        // 湖北，端口带宽>=1GBPS，是否大带宽默认为是，不可以修改（现改为统一配置 LocalPortBandwidthAttrHandler.set）
        /*String provinceNbr = ContextUtil.getLoginInfo().getUserInfo().getPostProvinceNbr();
        if (KiteStringUtils.equals(attr.getValue(), "1_0000106") && LocalKeyConsts.PROVINCE_HEBEI.equals(provinceNbr)) {
            String bandWidthDesc = inst.getAttrValueDesc("2_0000061");
            // 配置阈值
            String thresholdValueDesc = DcPublicCache.getPCode("2021121501", provinceNbr);
            if(KiteStringUtils.isNotEmpty(bandWidthDesc) && KiteStringUtils.isNotEmpty(thresholdValueDesc)) {
                if (CalculatePkgUsageUtil.compareWidth(bandWidthDesc, thresholdValueDesc)) {
                    attr.setIsEdit(KeyConsts.IFTRUE_F);
                }
            }
        }*/
        super.onShow(attr, inst, data);
    }
}
